function addField() {
    var type = $("#type").val();
    var field = $("#fieldName").val();
    var notes = $("#notes").val();
    var s = field.substr(0, 1);
    var s1 = field.substr(1, field.length);
    s = s.toLowerCase();
    field = s + s1;
    var s2 = field.substr(0, 1);
    var s3 = field.substr(1, field.length);
    s2 = s2.toUpperCase()
    var tempField = s2 + s3;
    if (type != "" && field != "") {
        //拼接field格式
        var fieldStr = "";
        fieldStr = fieldStr.concat("<div onclick='delField(\""+field+"\")' class='"+field+"'>");
        fieldStr = fieldStr.concat("<label style=\"font-size: large;text-indent:2em;color: #00a78e\">/**"+notes+"**/</label>");
        fieldStr = fieldStr.concat("<br />");
        fieldStr = fieldStr.concat("<label style=\"font-size: large;text-indent:2em\">");
        fieldStr = fieldStr.concat("<span style='color: #d58512'>private </span>");
        fieldStr = fieldStr.concat("<span style='color: #6164C1'>" + type + " </span><span style='color: #00aced'>" + field + "</span><span style='color: #d58512'>;</span>")
        fieldStr = fieldStr.concat("</label>");
        fieldStr = fieldStr.concat("<br /><br />");
        fieldStr = fieldStr.concat("</div>");
        //获取field的get/set方法
        var fieldGetSet = "";
        fieldGetSet = fieldGetSet.concat("<div class='"+field+"'>");
        //设置get语句
        var fieldGet = "";
        fieldGet = fieldGet.concat("<label style=\"font-size: large;text-indent:2em\">");
        fieldGet = fieldGet.concat("<span style='color: #d58512'>public </span>");
        fieldGet = fieldGet.concat("<span style='color: #6164C1'>" + type + "</span><span style='color: #00aced'> get" + tempField + "</span>(){")
        fieldGet = fieldGet.concat("</label>");
        fieldGet = fieldGet.concat("<br />");
        fieldGet = fieldGet.concat("<label style=\"font-size: large;text-indent:4em\">");
        fieldGet = fieldGet.concat("<span style='color: #9358ac;'>return </span>");
        fieldGet = fieldGet.concat("<span style='color: #ac2925'>this.</span><span style='color: #00aced'>" + field + "</span><span style='color: #d58512'>;</span>");
        fieldGet = fieldGet.concat("</label><br />");
        fieldGet = fieldGet.concat("<label style=\"font-size: large;text-indent:2em\">}</label><br />");
        //设置set语句
        var fieldSet = "";
        fieldSet = fieldSet.concat("<label style=\"font-size: large;text-indent:2em\">");
        fieldSet = fieldSet.concat("<span style='color: #d58512'>public </span>");
        fieldSet = fieldSet.concat("<span style='color: #6164C1'>" + type + "</span><span style='color: #00aced'> set" + tempField + "</span>(<span style='color: #6164C1'>" + type + " </span><span style='color: #00aced'>" + field + "</span>){")
        fieldSet = fieldSet.concat("</label>");
        fieldSet = fieldSet.concat("<br />");
        fieldSet =  fieldSet.concat("<label style=\"font-size: large;text-indent:4em\">");
        fieldSet = fieldSet.concat("<span style='color: #ac2925'>this.</span><span style='color: crimson'>" + field + "</span>=<span style='color: #00aced'>" + field + "</span><span style='color: #d58512'>;</span>");
        fieldSet = fieldSet.concat("</label><br />");
        fieldSet = fieldSet.concat("<label style=\"font-size: large;text-indent:2em\">}</label><br />");
        fieldGetSet = fieldGetSet.concat(fieldGet.concat(fieldSet));
        fieldGetSet = fieldGetSet.concat("</div>");
        //增加语句并清空填写框
        $("#fields").append(fieldStr);
        $("#getset").append(fieldGetSet);
        $("#type").val("");
        $("#fieldName").val("");
        $("#notes").val("");
    }
}

function delField(val){
    if(confirm("是否删除"+val)){
        $("."+val).remove();
    }
}